﻿
$(function() {
    $('#dlgcarport-join').dialog('close');
    $('#dlg-searchroom').dialog('close');
});

function carportjoin_show(){
    $('#dlgcarport-join').dialog('open');
    $('#dlgcarport_itemcode').combobox({ url: '../Controller.aspx?controller=RoomBrowseController&method=GetCbServiceItemData&ItemType=0'});
}

function btn_searchroom_search(){
    var areacode=$('#dlg_cbarea').combobox('getValue');
    var buildcode=$('#dlg_cbbuild').combobox('getValue');
    var roomnumber=$('#dlg_roomnumber').val();
    $('#roomlistGird').datagrid('options').url='../Controller.aspx?controller=RoomBrowseController&method=SearchRoom&areacode='+areacode+'&buildcode='+buildcode+'&roomnumber='+roomnumber;
    $('#roomlistGird').datagrid('reload');
}

function btn_carsearchowner(){
    $('#dlg-searchowner').dialog('open');
    $('#searchownerType').val(0);
}

function btn_carsearchroom_queding(){
    var seleced = $('#roomlistGird').datagrid('getSelected');
    if(seleced){
        $('#dlg-searchroom').dialog('close');
        $('#dlgcarport_roomId').val(seleced.RoomId);
        $('#dlgcarport_ownerId').val(seleced.OwnerId);
        $('#dlgcarport_roomnumber').val(seleced.RoomNumber);
        $('#dlgcarport_ownername').val(seleced.OwnerName);
        $('#dlgcarport_tel').val(seleced.OftenMobile);
    }
}

function btn_carsearchowner_queding(seleced){
    $('#dlgcarport_ownerId').val(seleced.OwnerId);
    $('#dlgcarport_ownername').val(seleced.Name);
    $('#dlgcarport_tel').val(seleced.OftenMobile);
}

function dlg_joincarport_queding(){
    //
    if (formvalidate('dlgcarport-join') == false) return false;
    var param={srccId:$('#dlgcarport_srccId').val(),roomnumber:$('#dlgcarport_roomnumber').val(),ownerId:$('#dlgcarport_ownerId').val(),OwnerName:$('#dlgcarport_ownername').val(),tel:$('#dlgcarport_tel').val(),CarNumber:$('#dlgcarport_CarNumber').val(),Carbrand:$('#dlgcarport_Carbrand').val(),itemcode:$('#dlgcarport_itemcode').combobox('getValue'),maturity:$('#dlgcarport_maturity').datebox('getValue'),Lastsurplus:$('#dlgcarport_Lastsurplus').val(),LastLateFee:$('#dlgcarport_LastLateFee').val()};
    requestAjax('../Controller.aspx?controller=RoomBrowseController&method=CarportJoin', param, function(data) {
        $('#floor').floor('reload');
        $('#dlgcarport-join').dialog('close');
    });
}